//
//  SCOutsideWebJumpToAppManager.m
//  Shuaicheyeguan
//
//  Created by xiangtao on 2025/3/27.
//

#import "SCOutsideWebJumpToAppManager.h"
#import "SCRNEventManager.h"

@implementation SCOutsideWebJumpToAppManager

+ (void)handleUrlString:(NSString *)urlString
{
  LogInfo(@"urlString = %@",urlString);
  NSArray *parArray = [urlString componentsSeparatedByString:@"?"];
  if (parArray.count < 2) {
      return ;
  }
  NSString *parameterString = [parArray objectAtIndex:1];
  
  NSArray *paramArray = [parameterString componentsSeparatedByString:@"&"];
  if (paramArray.count < 1) {
      return;
  }
  
  NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithCapacity:0];
  for (NSString *param in paramArray) {
    if ([param rangeOfString:@"="].location != NSNotFound) {
      NSString *key = [param componentsSeparatedByString:@"="].firstObject;
        NSString *value = [param componentsSeparatedByString:@"="].lastObject;
      [parameters setObject:value forKey:key];
    }
  }
  [[SCRNEventManager shareInstance] outsideWebJump:parameters];
}

@end
